﻿

namespace EveKillboard.Core
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using Base;

    [Table("Items")]
    public class Item : ItemBase, IComparable
    {
        [Key]
        [Column("ID")]
        public override int Id { get; set; }
        [Column("Name")]
        public override string Name { get; set; }
        [Column("GroupID", TypeName = "smallint")]
        public override short GroupId { get; set; }
        [Column("SlotType", TypeName = "smallint")]
        public override short? SlotType { get; set; }
        [Column("IsCharge")]
        public override bool IsCharge { get; set; }

        public virtual ItemGroup Group { get; set; }
        public virtual IList<ItemValue> Prices { get; set; }

        public override string ToString()
        {
            return Name;
        }

        #region IComparable Members

        public int CompareTo(object obj)
        {
            var item = obj as Item;
            return item != null ? item.Id.CompareTo(Id) : 0;
        }

        #endregion
    }
}